Full source code giải đố hình đơn giản
16.650 lượt xem;
- GameData.cs
- Puzzle Game Saver /
- Scripts /
- Assets /
- project /
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 using System;
5 using System.IO;
6 using System.Runtime.Serialization.Formatters.Binary;
7
8 [Serializable]
9 public class GameData{
10
11 private bool[] candyPuzzleLevels;
12 private bool[] transportPuzzleLevels;
13 private bool[] shapePuzzleLevels;
14
15 private int[] candyPuzzleLevelStars;
16 private int[] transportPuzzleLevelStars;
17 private int[] shapePuzzleLevelStars;
18
19 private bool isGameStartedForTheFirstTime;
20
21 private float musicVolume;
22
23 public void SetCandyPuzzleLevels(bool[] candyPuzzleLevels)
24 {
25 this.candyPuzzleLevels = candyPuzzleLevels;
26 }
27
28 public bool [] GetCandyPuzzleLevels()
29 {
30 return this.candyPuzzleLevels;
31 }
32
33 public void SetTransportPuzzleLevels(bool[] transportPuzzleLevels)
34 {
35 this.transportPuzzleLevels = transportPuzzleLevels;
36 }
37
38 public bool[] GetTransportPuzzleLevels()
39 {
40 return this.transportPuzzleLevels;
41 }
42
43 public void SetShapePuzzleLevels(bool[] shapePuzzleLevels)
44 {
45 this.shapePuzzleLevels = shapePuzzleLevels;
46 }
47
48 public bool[] GetShapePuzzleLevels()
49 {
50 return this.shapePuzzleLevels;
51 }
52
53 public void SetCandyPuzzleLevelStars(int[] candyPuzzleLevelStars)
54 {
55 this.candyPuzzleLevelStars = candyPuzzleLevelStars;
56 }
57
58 public int[] GetCandyPuzzleLevelStars()
59 {
60 return this.candyPuzzleLevelStars;
61 }
62
63 public void SetTransportPuzzleLevelStars(int[] transportPuzzleLevelStars)
64 {
65 this.transportPuzzleLevelStars = transportPuzzleLevelStars;
66 }
67
68 public int[] GetTransportPuzzleLevelStars()
69 {
70 return this.transportPuzzleLevelStars;
71 }
72
73 public void SetShapePuzzleLevelStars(int[] shapePuzzleLevelStars)
74 {
75 this.shapePuzzleLevelStars = shapePuzzleLevelStars;
76 }
77
78 public int[] GetShapePuzzleLevelStars()
79 {
80 return this.shapePuzzleLevelStars;
81 }
82
83
84 public void SetIsGameStartedForTheFirstTime(bool isGameStartedForTheFirstTime)
85 {
86 this.isGameStartedForTheFirstTime = isGameStartedForTheFirstTime;
87 }
88
89 public bool GetIsGameStartedForTheFirstTime()
90 {
91 return this.isGameStartedForTheFirstTime;
92 }
93
94 public void SetMusicVolume(float musicVolume)
95 {
96 this.musicVolume = musicVolume;
97 }
98
99 public float GetMusicVolume()
100 {
101 return this.musicVolume;
102 }
103 }
2 using System.Collections.Generic;
3 using UnityEngine;
4 using System;
5 using System.IO;
6 using System.Runtime.Serialization.Formatters.Binary;
7
8 [Serializable]
9 public class GameData{
10
11 private bool[] candyPuzzleLevels;
12 private bool[] transportPuzzleLevels;
13 private bool[] shapePuzzleLevels;
14
15 private int[] candyPuzzleLevelStars;
16 private int[] transportPuzzleLevelStars;
17 private int[] shapePuzzleLevelStars;
18
19 private bool isGameStartedForTheFirstTime;
20
21 private float musicVolume;
22
23 public void SetCandyPuzzleLevels(bool[] candyPuzzleLevels)
24 {
25 this.candyPuzzleLevels = candyPuzzleLevels;
26 }
27
28 public bool [] GetCandyPuzzleLevels()
29 {
30 return this.candyPuzzleLevels;
31 }
32
33 public void SetTransportPuzzleLevels(bool[] transportPuzzleLevels)
34 {
35 this.transportPuzzleLevels = transportPuzzleLevels;
36 }
37
38 public bool[] GetTransportPuzzleLevels()
39 {
40 return this.transportPuzzleLevels;
41 }
42
43 public void SetShapePuzzleLevels(bool[] shapePuzzleLevels)
44 {
45 this.shapePuzzleLevels = shapePuzzleLevels;
46 }
47
48 public bool[] GetShapePuzzleLevels()
49 {
50 return this.shapePuzzleLevels;
51 }
52
53 public void SetCandyPuzzleLevelStars(int[] candyPuzzleLevelStars)
54 {
55 this.candyPuzzleLevelStars = candyPuzzleLevelStars;
56 }
57
58 public int[] GetCandyPuzzleLevelStars()
59 {
60 return this.candyPuzzleLevelStars;
61 }
62
63 public void SetTransportPuzzleLevelStars(int[] transportPuzzleLevelStars)
64 {
65 this.transportPuzzleLevelStars = transportPuzzleLevelStars;
66 }
67
68 public int[] GetTransportPuzzleLevelStars()
69 {
70 return this.transportPuzzleLevelStars;
71 }
72
73 public void SetShapePuzzleLevelStars(int[] shapePuzzleLevelStars)
74 {
75 this.shapePuzzleLevelStars = shapePuzzleLevelStars;
76 }
77
78 public int[] GetShapePuzzleLevelStars()
79 {
80 return this.shapePuzzleLevelStars;
81 }
82
83
84 public void SetIsGameStartedForTheFirstTime(bool isGameStartedForTheFirstTime)
85 {
86 this.isGameStartedForTheFirstTime = isGameStartedForTheFirstTime;
87 }
88
89 public bool GetIsGameStartedForTheFirstTime()
90 {
91 return this.isGameStartedForTheFirstTime;
92 }
93
94 public void SetMusicVolume(float musicVolume)
95 {
96 this.musicVolume = musicVolume;
97 }
98
99 public float GetMusicVolume()
100 {
101 return this.musicVolume;
102 }
103 }